/**
 * Author: Dmitry Ustimov
 * Date: 5/14/13
 * Time: 10:07 PM
 */

package com.gmail.dmitryustimov.ms.java7.mediator.classic.example.classic_example3;

public class FanB extends Fan {

    public FanB(FacebookGroupMediator mediator, String name)  {
        this.name = name;
        this.mediator = mediator;
        this.receiver = this.new FanBReceiver();
        mediator.signOn(this.receiver);
    }

    public class FanBReceiver implements Receiver {

        // Does not get copies of own messages
        @Override
        public void receive(String message, String from) {
            if (!name.equals(from)) {
                System.out.println(name + " received from " + from + ": " + message);
            }
        }
    }
}


